package com.bw.zg3_day03lx.user

import androidx.lifecycle.MutableLiveData
import com.bw.base.entity.UserBean
import com.bw.base.mvvm.BaseViewModel
import com.bw.base.net.ApiService
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
@HiltViewModel
class UserViewModel @Inject constructor(val apiService: ApiService): BaseViewModel() {
    val loginData = MutableLiveData<UserBean>()
    fun login(username: String, password: String){
        httpRequest({apiService.login(username, password)},loginData::postValue)
    }

    val registerData = MutableLiveData<UserBean>()
    fun register(username: String, password: String){
        httpRequest({apiService.register(username, password)}, registerData::postValue)
    }
}